package com.kgc.crowd.distributioncrowdcommon.api;

import com.github.pagehelper.PageInfo;
import com.kgc.crowd.distributioncrowdcommon.pojo.*;
import com.kgc.crowd.distributioncrowdcommon.vo.ProjectVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("DISTRIBUTION-CROWD-DATABASE-PROVIDER")
public interface DataBaseOperationRemoteService {
    @RequestMapping("/database/provider/retrieve/loign/acct/count")
    ResultEntity<Integer> retrieveLoignAcctCount(@RequestParam("loginAcct") String loginAcct);

    @RequestMapping("/database/provider/save/member/remote")
    ResultEntity<String> saveMemberRemote(@RequestBody MemberPO memberPO);

    @RequestMapping("/database/provider/retrieve/member/by/login/acct")
    ResultEntity<MemberPO> retrieveMemberByLoginAcct(@RequestParam("loginAcct") String loginAcct);
    @RequestMapping("/database/provider/save/project/remote/{memberId}")
    public ResultEntity<String> saveProjectRemote(
            @RequestBody ProjectVO projectVO,
            @PathVariable("memberId") String memberId);
    @RequestMapping("/database/provider/select/all/type")
    public ResultEntity<List<TypePO>> selectTypePO();
    @RequestMapping("/database/provider/select/all/tag")
    public ResultEntity<List<TagPO>> selectTagPO();

    @RequestMapping("/database/provider/retrieve/member/launch/info/po")
    public ResultEntity<MemberLaunchInfoPO> retrieveMemberLaunchInfoPO(@RequestParam("memberId") Integer memberId);
    @RequestMapping("/database/provider/selectProjectByType")
    public ResultEntity<PageInfo<ProjectPO>> selectProjectByType(
            @RequestParam(value="pageNum", defaultValue="1",required = false) Integer pageNum,
            @RequestParam(value="pageSize", defaultValue="5",required = false) Integer pageSize,
            @RequestParam(value="typeId", defaultValue="0",required = false) Integer typeId,
            @RequestParam(value="keyword", defaultValue="",required = false) String keyword
    );

    @RequestMapping("/database/provider/save/project")
    public ResultEntity<String> insertProject(@RequestBody ProjectPO projectPO);

    @RequestMapping("/database/provider/selectAllType")
    public ResultEntity<List<TypePO>> selectAllType();

    @RequestMapping("/database/provider/select/project/itempic")
    public ResultEntity<ProjectPO> selectPorjectItemPid(@RequestParam(value="id", defaultValue="0",required = false) Integer id);


    @RequestMapping("/database/provider/select/project/member")
    public ResultEntity<List<ProjectPO>> selectProjectByMemberId(@RequestParam(value="id", defaultValue="0",required = false) Integer id);

    @RequestMapping("/database/provider/select/project/advertisement")
    public ResultEntity<List<ProjectPO>> selectProjectAndAdvertisement(@RequestParam(value="id", defaultValue="0",required = false) Integer id);

    @RequestMapping("/database/provider/select/project/order")
    public ResultEntity<List<Order>> selectOrderAndProject(@RequestParam(value="id", defaultValue="0",required = false) Integer id);

    @RequestMapping("/database/provider/select/project/return")
    public ResultEntity<ProjectPO> selectProjectAndReturn(@RequestParam(value="id", defaultValue="0",required = false) Integer id);

}
